<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>页面1</h1>
    <button class="back">回退</button>
    <button class="page2">前进</button>
    <script>
          document.getElementsByClassName("back")[0].onclick = function(){
            //   回退到上一个历史记录
            window.history.back();
        }

        document.getElementsByClassName("page2")[0].onclick = function(){
            window.location.href = "./page2.html";
        }
    </script>
</body>
</html>